home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 12.5 KB | 334 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Freehand.vu
- #
- # Contains: Quick look test script for Freehand version 3.1
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.7> 12/13/93 KTA ModifyDocument returns a -1 if Scrapbook test fails.
- # <1.0.6> 9/28/93 KTA Added returnVal for ModifyDocument hook.
- # <1.0.3> 7/19/93 KTA Updates for FindWindow() to handle descriptors.
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","DA.Lib","UserInterface.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: Kevin Avoy
- # Description: Sets up the tool palette for Freehand. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- #########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
- global kToolPaletteNum := 1;
- global kLinePaletteNum := 0;
- global kPatternPaletteNum := 0;
- global kColorPaletteNum := 2;
-
- global gLineWeights := {'Hairline','.5 pt','1 pt','1.5 pt','2 pt','4 pt','6 pt','8 pt','12 pt'};
-
- global gScreenInset := {0,35,0,0}; # Screen inset
- global gDocumentWindow := [window c:True g:True z:True]!;
- global gPaletteList := {
- { #### Start Palette #1 - Tools
- {'Tools',12}, # List := {Specifier for Palette window ("String" if TITLE, integer if ORD), Header height}.
- kPalWind, # Palette type
- {2,9}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {25,18} # Offset between tools {h,v}
- }, #### End Palette #1
- { #### Start Palette #2 - Colors
- {'Colors',43}, # List := {Specifier for Palette window ("String" if TITLE, integer if ORD), Header height}.
- kPalWind, # Palette type
- {1,8}, # Size of Tool matrix {numElemsWide,numElemsTall}
- {0,12} # Offset between tools {h,v}
- } #### End Palette #1
- };
-
- # Need to set up and redefine color palette, default has only none, black and white
-
- ### FreeHand {Flag, Pattern, Line, Color}
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global ArrowTool := { 1, 1, "Arrow", kClick, 0, {0}};
- global CharTool := { 2, 1, "Char", kClick, 0, {global gTextStr,0,0,0}};
- global RectTool := { 3, 1, "Rect", kDrag, 0, {2,0,1,0}};
- global RoundRectTool := { 4, 1, "RoundRect", kDrag, 0, {2,0,1,0}};
-
- global OvalTool := { 5, 1, "Oval", kDrag, 0, {2,0,1,0}};
- global LineTool := { 6, 1, "Line", kDrag, 0, {2,0,1,0}};
- global FreeHandTool := { 7, 1, "FreeHand", kMultiDrag, 0, {0}};
- global PointTool := { 8, 1, "Point", kMultiClick,0, {2,0,1,0}};
-
- global KnifeTool := { 9, 1, "Knife", kClick, 0, {0}};
- global BezRound := { 10, 1, "BezRound", kMultiClick, 1, {2,0,1,0}};
- global BezStraight := { 11, 1, "BezStraight", kMultiClick, 1, {2,0,1,0}};
- global BezCorner := { 12, 1, "BezCorner", kMultiClick, 1, {2,0,1,0}};
-
- global NewAngle := { 13, 1, "NewAngle", kDrag, 0, {0}};
- global MirrorAngle := { 14, 1, "MirrorAngle", kDrag, 0, {0}};
- global Porportion := { 15, 1, "Porportion", kDrag, 0, {0}};
- global Perspective := { 16, 1, "Perspective", kDrag, 0, {0}};
- global DupSelect := { 17, 1, "DupSelect", kDrag, 0, {2,0,1,0}};
- global ZoomTool := { 18, 1, "ZoomTool", kClick, 0, {0}};
-
- # Need to add color attribute once color palette is setup and redefined
-
- # global Tool list
- global gToolList:={ ArrowTool,
- #CharTool,
- RectTool,
- RoundRectTool,
-
- OvalTool,
- LineTool,
- FreeHandTool,
- PointTool,
-
- KnifeTool,
- BezRound,
- BezStraight,
- BezCorner,
-
- NewAngle,
- MirrorAngle,
- Porportion,
- Perspective,
-
- DupSelect,
- ZoomTool
- };
-
- ### font characteristic lists
- global gFontSizeList := {'8','9','10','11','12','14','18','24','36','48','72'};
- global gFontStyleList := {};
-
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- end; # InitAppGlobals
-
- #########################################################################
- # DoDrawFreehand()
- #========================================================================
- # Author: KTA
- # Description: Does Freehand draw.
- # Parameters: None
- # Returns: Nada
- # Examples: DoDrawFreehand();
- # Assumptions: FreeHand
- #========================================================================
- # History:
- #
- #########################################################################
- task DoDrawFreehand()
- begin
- if not match [window t:'Tools']! # if tools window not available
- SelectMenuItem("Toolbox","Windows","View"); # display it
- if not match [window t:'Colors']! # if Colors window not available
- SelectMenuItem("Colors","Windows","View"); # display it
- DoDraw(, global gDocumentWindow);
- if match [window t:'Colors']! # if Colors window open
- SelectMenuItem("Colors","Windows","View"); # close it
- end;
-
- #########################################################################
- # DoTextFreehand()
- #========================================================================
- # Author: KTA
- # Description: Does Freehand text.
- # Parameters: None
- # Returns: Nada
- # Examples: DoTextFreehand();
- # Assumptions: FreeHand
- #========================================================================
- # History:
- #
- #########################################################################
- task DoTextFreehand()
- begin
- if match [window t:'Colors']! # if Colors window open
- SelectMenuItem("Colors","Windows","View"); # close it
- if not match [window t:'Tools']! # if tools window not available
- SelectMenuItem("Toolbox","Windows","View"); # display it
- if match [window t:'Tools']! # if tools window now available
- begin
- SetTool(global CharTool); # select the char tool
- SelectMenuItem("Toolbox","Windows","View"); # close the tools window
- MoveRelativeToWindow(,,,2); # click in doc window to define text box
- if Findwindow('Text') # if text window pops open
- begin
- DoText();
- if match [button t:'OK' e:true]!
- SpecialKey(EnterKey, "EnterKey"); # scraptext set up properly
- else begin
- selectbutton('Cancel'); # scraptext not set up properly
- logstr("!@#$% Problem with DoText! No text typed in window!");
- end;
- end; # if Findwindow('Text')
- else
- logstr("!@#$% There was a problem opening the text window!
- text not tested!");
- end; # if match [window t:'Tools']!
- else
- logstr("!@#$% There was a problem accessing the tools window!
- text not tested!");
- end;
-
- #########################################################################
- # FreeHandModifyDocument()
- #========================================================================
- # Author: ML
- # Description: Modify FreeHand Document
- # Parameters: None
- # Returns: Nothing
- # Examples: FreeHandModifyDocument();
- # Assumptions: None
- # Applications: FreeHand
- #========================================================================
- # History:
- #
- #########################################################################
- task FreeHandModifyDocument()
- begin
- retVal := Scrapbook(global kScrapPICT);
- if not(retVal)
- retVal := -1; # ScrapBook failed so can't modifyDoc
- else
- retVal := 1;
-
- return(retVal);
- end;
-
- #########################################################################
- # FreeHandScrapText()
- #========================================================================
- # Author: ML
- # Description: Paste text into FreeHand Document
- # Parameters: None
- # Returns: Nothing
- # Examples: FreeHandScrapText();
- # Assumptions: None
- # Applications: FreeHand
- #========================================================================
- # History:
- #
- #########################################################################
- task FreeHandScrapText()
- begin
- if match [window t:'InfoBarWin']! # if InfoBarWin window open
- SelectMenuItem("Info Bar","Windows","View"); # close it
- if match [window t:'Colors']! # if Colors window open
- SelectMenuItem("Colors","Windows","View"); # close it
- if match [window t:'Layers']! # if Layers window open
- SelectMenuItem("Layers","Windows","View"); # close it
- if match [window t:'Styles']! # if Styles window open
- SelectMenuItem("Styles","Windows","View"); # close it
- if not match [window t:'Tools']! # if tools window not open
- SelectMenuItem("Toolbox","Windows","View"); # display it
- if match [window t:'Tools']! # if tools window now available
- begin
- SetTool(global CharTool); # select the char tool
- SelectMenuItem("Toolbox","Windows","View"); # close the tools window
- MoveRelativeToWindow(,,,2); # click in doc window to define text box
- if Findwindow('Text') # if text window pops open
- begin
- Scrapbook(global kScrapText);
- if match [button t:'OK' e:true]!
- SpecialKey(EnterKey, "EnterKey"); # scraptext set up properly
- else begin
- selectbutton('Cancel'); # scraptext not set up properly
- logstr("!@#$% Scraptext not set up properly!");
- end;
- end; # if Findwindow('Text')
- else
- logstr("!@#$% There was a problem opening the text window!
- Scraptext not tested!");
- end; # if match [window t:'Tools']!
- else
- logstr("!@#$% There was a problem accessing the tools window!
- Scraptext not tested!");
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script Freehand (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel);
- InitDraw();
- InitFonts();
- global gApptitle := "Aldus FreeHand";
- global gAppVersion := '3'; # version of app you will be running
- global gModifyDocument:= task FreeHandModifyDocument; # define app specific task
- global gCustomScrapText:= task FreeHandScrapText; # define app specific task
- SuiteStart('Freehand.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gFileName := "@!@-{gBuildVers}-FreeHand";
- global gSetLine := Task SetLineMenuItems; # Requires VU 2.0
- InitAppGlobals(); # init app specific globals
- (*
- *)
-
- DoSetUpApp(,-1,,1,1,1,1);
-
- DoDrawFreehand();
-
- DoTextFreehand();
-
- DoWindow(,global gDocumentWindow);
-
- DoCloseApp(1,-1);
-
- LogStr("############################# LIMITATIONS: ############################");
- LogStr("NOTE: Only 'Plain' text is tested in DoText because not all fonts
- have all styles enabled");
-
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script Freehand
-
- ### What's Needed
- # 1) Figure out way to setup color palette - default has only none, black and white